home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / lib / mozilla-firefox / include / nkcache / nsICache.h < prev    next >
C/C++ Source or Header  |  2006-05-08  |  7KB  |  212 lines

  1. /*
  2.  * DO NOT EDIT.  THIS FILE IS GENERATED FROM nsICache.idl
  3.  */
  4.  
  5. #ifndef __gen_nsICache_h__
  6. #define __gen_nsICache_h__
  7.  
  8.  
  9. #ifndef __gen_nsISupports_h__
  10. #include "nsISupports.h"
  11. #endif
  12.  
  13. /* For IDL files that don't want to include root IDL files. */
  14. #ifndef NS_NO_VTABLE
  15. #define NS_NO_VTABLE
  16. #endif
  17. typedef PRInt32 nsCacheStoragePolicy;
  18.  
  19. typedef PRInt32 nsCacheAccessMode;
  20.  
  21.  
  22. /* starting interface:    nsICache */
  23. #define NS_ICACHE_IID_STR "ec1c0063-197d-44bb-84ba-7525d50fc937"
  24.  
  25. #define NS_ICACHE_IID \
  26.   {0xec1c0063, 0x197d, 0x44bb, \
  27.     { 0x84, 0xba, 0x75, 0x25, 0xd5, 0x0f, 0xc9, 0x37 }}
  28.  
  29. /**
  30.  * nsICache is a namespace for various cache constants.  It does not represent
  31.  * an actual object.
  32.  */
  33. class NS_NO_VTABLE nsICache {
  34.  public: 
  35.  
  36.   NS_DEFINE_STATIC_IID_ACCESSOR(NS_ICACHE_IID)
  37.  
  38.   /**
  39.      * Access Modes
  40.      *
  41.      *
  42.      * Mode Requested | Not Cached          | Cached
  43.      * ------------------------------------------------------------------------
  44.      * READ           | KEY_NOT_FOUND       | NS_OK
  45.      *                | Mode = NONE         | Mode = READ
  46.      *                | No Descriptor       | Descriptor
  47.      * ------------------------------------------------------------------------
  48.      * WRITE          | NS_OK               | NS_OK            (Cache service
  49.      *                | Mode = WRITE        | Mode = WRITE      dooms existing
  50.      *                | Descriptor          | Descriptor        cache entry)
  51.      * ------------------------------------------------------------------------
  52.      * READ_WRITE     | NS_OK               | NS_OK
  53.      * (1st req.)     | Mode = WRITE        | Mode = READ_WRITE
  54.      *                | Descriptor          | Descriptor
  55.      * ------------------------------------------------------------------------
  56.      * READ_WRITE     | N/A                 | NS_OK
  57.      * (Nth req.)     |                     | Mode = READ
  58.      *                |                     | Descriptor
  59.      * ------------------------------------------------------------------------
  60.      *
  61.      *
  62.      * Access Requested:
  63.      *
  64.      * READ           - I only want to READ, if there isn't an entry just fail
  65.      * WRITE       - I have something new I want to write into the cache, make
  66.      *               me a new entry and doom the old one, if any.
  67.      * READ_WRITE  - I want to READ, but I'm willing to update an existing
  68.      *               entry if necessary, or create a new one if none exists.
  69.      *
  70.      *
  71.      * Access Granted:
  72.      *
  73.      * NONE        - No descriptor is provided. You get zilch. Nada. Nothing.
  74.      * READ           - You can READ from this descriptor.
  75.      * WRITE       - You must WRITE to this descriptor because the cache entry
  76.      *               was just created for you.
  77.      * READ_WRITE  - You can READ the descriptor to determine if it's valid,
  78.      *               you may WRITE if it needs updating.
  79.      *
  80.      *
  81.      * Comments:
  82.      *
  83.      * If you think that you might need to modify cached data or meta data,
  84.      * then you must open a cache entry requesting WRITE access.  Only one
  85.      * cache entry descriptor, per cache entry, will be granted WRITE access.
  86.      * 
  87.      * Usually, you will request READ_WRITE access in order to first test the
  88.      * meta data and informational fields to determine if a write (ie. going
  89.      * to the net) may actually be necessary.  If you determine that it is 
  90.      * not, then you would mark the cache entry as valid (using MarkValid) and
  91.      * then simply read the data from the cache.
  92.      *
  93.      * A descriptor granted WRITE access has exclusive access to the cache
  94.      * entry up to the point at which it marks it as valid.  Once the cache
  95.      * entry has been "validated", other descriptors with READ access may be
  96.      * opened to the cache entry.
  97.      *
  98.      * If you make a request for READ_WRITE access to a cache entry, the cache
  99.      * service will downgrade your access to READ if there is already a
  100.      * cache entry descriptor open with WRITE access.
  101.      *
  102.      * If you make a request for only WRITE access to a cache entry and another
  103.      * descriptor with WRITE access is currently open, then the existing cache
  104.      * entry will be 'doomed', and you will be given a descriptor (with WRITE
  105.      * access only) to a new cache entry.
  106.      *
  107.      */
  108.   enum { ACCESS_NONE = 0 };
  109.  
  110.   enum { ACCESS_READ = 1 };
  111.  
  112.   enum { ACCESS_WRITE = 2 };
  113.  
  114.   enum { ACCESS_READ_WRITE = 3 };
  115.  
  116.   /**
  117.      * Storage Policy
  118.      *
  119.      * The storage policy of a cache entry determines the device(s) to which
  120.      * it belongs.  See nsICacheSession and nsICacheEntryDescriptor for more
  121.      * details.
  122.      *
  123.      * STORE_ANYWHERE        - Allows the cache entry to be stored in any device.
  124.      *                         The cache service decides which cache device to use
  125.      *                         based on "some resource management calculation."
  126.      * STORE_IN_MEMORY       - Requires the cache entry to reside in non-persistent
  127.      *                         storage (ie. typically in system RAM).
  128.      * STORE_ON_DISK         - Requires the cache entry to reside in persistent
  129.      *                         storage (ie. typically on a system's hard disk).
  130.      * STORE_ON_DISK_AS_DISK - Requires the cache entry to reside in persistent
  131.      *                         storage, and in a specific file.
  132.      */
  133.   enum { STORE_ANYWHERE = 0 };
  134.  
  135.   enum { STORE_IN_MEMORY = 1 };
  136.  
  137.   enum { STORE_ON_DISK = 2 };
  138.  
  139.   enum { STORE_ON_DISK_AS_FILE = 3 };
  140.  
  141.   /**
  142.      * All entries for a cache session are stored as streams of data or
  143.      * as objects.  These constant my be used to specify the type of entries
  144.      * when calling nsICacheService::CreateSession().
  145.      */
  146.   enum { NOT_STREAM_BASED = 0 };
  147.  
  148.   enum { STREAM_BASED = 1 };
  149.  
  150.   /**
  151.      * The synchronous OpenCacheEntry() may be blocking or non-blocking.  If a cache entry is
  152.      * waiting to be validated by another cache descriptor (so no new cache descriptors for that
  153.      * key can be created, OpenCacheEntry() will return NS_ERROR_CACHE_WAIT_FOR_VALIDATION in
  154.      * non-blocking mode.  In blocking mode, it will wait until the cache entry for the key has
  155.      * been validated or doomed.  If the cache entry is validated, then a descriptor for that
  156.      * entry will be created and returned.  If the cache entry was doomed, then a descriptor
  157.      * will be created for a new cache entry for the key. 
  158.      */
  159.   enum { NON_BLOCKING = 0 };
  160.  
  161.   enum { BLOCKING = 1 };
  162.  
  163. };
  164.  
  165. /* Use this macro when declaring classes that implement this interface. */
  166. #define NS_DECL_NSICACHE \
  167.  
  168. /* Use this macro to declare functions that forward the behavior of this interface to another object. */
  169. #define NS_FORWARD_NSICACHE(_to) \
  170.  
  171. /* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
  172. #define NS_FORWARD_SAFE_NSICACHE(_to) \
  173.  
  174. #if 0
  175. /* Use the code below as a template for the implementation class for this interface. */
  176.  
  177. /* Header file */
  178. class nsCache : public nsICache
  179. {
  180. public:
  181.   NS_DECL_ISUPPORTS
  182.   NS_DECL_NSICACHE
  183.  
  184.   nsCache();
  185.  
  186. private:
  187.   ~nsCache();
  188.  
  189. protected:
  190.   /* additional members */
  191. };
  192.  
  193. /* Implementation file */
  194. NS_IMPL_ISUPPORTS1(nsCache, nsICache)
  195.  
  196. nsCache::nsCache()
  197. {
  198.   /* member initializers and constructor code */
  199. }
  200.  
  201. nsCache::~nsCache()
  202. {
  203.   /* destructor code */
  204. }
  205.  
  206. /* End of implementation class template. */
  207. #endif
  208.  
  209. #include "nsNetError.h"
  210.  
  211. #endif /* __gen_nsICache_h__ */
  212.